home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 6
/
The Arsenal Files 6 (Arsenal Computer).ISO
/
prg_casm
/
jlvesa11.zip
/
JLVESA.H
< prev
next >
Wrap
Text File
|
1996-01-03
|
10KB
|
230 lines
/********************************************************************
* JLVesa SVGA library
* Copyright 1995 Johannes Lehtinen
* All rights reserved
********************************************************************/
#ifndef __JV_JLVESA_H__
#define __JV_JLVESA_H__
/********************************************************************
* Some constant #defines
********************************************************************/
#define JV_SUCCESS 0
#define JV_FAILURE 1
/********************************************************************
* Some type definitions for unsigned/signed bytes, words and dwords
********************************************************************/
typedef unsigned long int JVUDword;
typedef unsigned short int JVUWord;
typedef unsigned char JVUByte;
typedef signed long int JVSDword;
typedef signed short int JVSWord;
typedef signed char JVSByte;
typedef unsigned char JVFlag;
typedef JVUByte JVPalette[256][3];
typedef struct JVFont
{
JVUWord offset[256]; /* Offsets of character images. If the
* character does not have corresponding
* object, 0xFFFF is used. */
JVUWord height; /* Height of font */
JVUWord width; /* Default width for character cell.
* Different characters may still have
* different width. */
JVUByte *font_data; /* Font images. First byte of image is
* the actual length of the character.
* Rest of the data is like any image. */
};
/*********************************************************************
* Data structures used
*********************************************************************/
/* Data structure for VESA SVGA info */
struct JVSVGAInfo
{
JVUByte signature[4]; /* Signature "VESA" */
JVUByte ver_minor, ver_major; /* Version number */
char *oem_name; /* OEM-name of the VESA */
JVUDword capabilities; /* Capabilities (no exact info available) */
JVUWord (*modes)[]; /* List of supported VESA-modes (terminated
with 0ffffH) */
JVUWord memory; /* Amount of memory in 64Kb blocks */
JVUByte reserved[236]; /* Reserved for future use */
};
/* Data structure for VESA mode info */
struct JVModeInfo
{
struct /* Mode attributes */
{
int support : 1; /* Set if mode supported */
int optional_info : 1; /* Set if optional info available */
int BIOS_support : 1; /* Set if BIOS output supported */
int color : 1; /* Set if color mode */
int graphics : 1; /* Set if graphics mode */
int reserved : 11; /* Not used */
} mode_attr;
struct /* Window attributes */
{
int A_exists : 1; /* Set if window A exists */
int A_readable : 1; /* Set if window A readable */
int A_writable : 1; /* Set if window A writable */
int A_reserved : 5; /* Reserved */
int B_exists : 1; /* Set if window B exists */
int B_readable : 1; /* Set if window B readable */
int B_writable : 1; /* Set if window B writable */
int B_reserved : 5; /* Reserved */
} win_attr;
JVUWord win_granularity; /* Window granularity in kilobytes */
JVUWord win_size; /* Window size in kilobytes */
JVUWord winA_seg; /* Start segment of window A */
JVUWord winB_seg; /* Start segment of window B */
JVUDword pos_func; /* Window positioning function */
JVUWord bytes_per_line; /* Bytes per scan line */
/* Following is optional information, check mode_attr.optional_info */
JVUWord width; /* Width in pixels */
JVUWord height; /* Height in pixels */
JVUByte char_width; /* Width of character cell in pixels */
JVUByte char_height; /* Height of character cell in pixels */
JVUByte planes; /* Number of memory planes */
JVUByte bits_per_pixel; /* Number of bits per pixel */
JVUByte banks; /* Number of memory banks */
JVUByte model; /* Memory model type
0 - Text mode
1 - CGA graphics
2 - Hercules graphics
3 - EGA 16 colors
4 - packed pixels
5 - non chain 4 256 color modes
6 - direct 15/16/24 bits
7 - YUV */
JVUByte bank_size; /* Size of memory bank */
JVUByte pages; /* Number of image pages -1 */
JVUByte reserved1; /* Reserved */
/* Following are available in VESA v1.02+ */
JVUByte red_size; /* Red mask size */
JVUByte red_pos; /* Red mask position */
JVUByte green_size; /* Green mask size */
JVUByte green_pos; /* Green mask position */
JVUByte blue_size; /* Blue mask size */
JVUByte blue_pos; /* Blue mask position */
JVUByte res_size; /* Reserved mask size */
JVUByte res_pos; /* Reserved mask position */
JVUByte direct_info; /* Direct screen mode info */
JVUByte reserved2[215]; /* Reserved */
};
typedef struct JVSVGAInfo JVSVGAInfo;
typedef struct JVModeInfo JVModeInfo;
/******************************************************************
* Defines for those who are using old function names. Remember to
* define JV_OLD_FUNC_NAMES, if using old function names!
******************************************************************/
#ifdef JV_OLD_FUNC_NAMES
#define vesa_svga_info JVSVGA_GetInfo
#define vesa_mode_info JVSVGA_GetModeInfo
#define vesa_set_mode JVSVGA_SetMode
#define vesa_get_mem JVSVGA_GetMemory
#define vesa_set_vstart JVScreen_SetVisual
#define vesa_clr_mem JVScreen_ClearAll
#define vesa_put_pixel JVPixel_Draw
#define vesa_draw_block JVRectangle_Draw
#define vesa_draw_line JVLine_Draw
#define vesa_put_image JVImage_Draw
#define vesa_put_image_on JVImage_DrawOn
#define vesa_vretrace JVSVGA_WaitForVRetrace
#define vesa_set_palette JVPalette_Set
#define vesa_get_image JVImage_Read
#define vesa_set_astart JVScreen_SetActive
#define vesa_set_lwidth JVScreen_SetLogicalWidth
#define vesa_set_color JVColor_Set
#define vesa_find_color JVColor_Find
#define vesa_put_image_limit JVImage_DrawLimited
#define vesa_put_image_on_limit JVImage_DrawOnLimited
#define vesa_get_pixel JVPixel_Read
#define vesa_select_font JVFont_Select
#define vesa_put_text JVText_Draw
#define vesa_colorize_font JVFont_Colorize
#define vesa_strlen JVText_GetLength
#define vesa_get_text JVText_Input
#define vesa_draw_line_limit JVLine_DrawLimited
#endif
/******************************************************************
* Function prototypes
******************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
JVFlag JVSVGA_GetInfo(JVSVGAInfo *info);
JVFlag JVSVGA_GetModeInfo(JVUWord mode, JVModeInfo *info);
JVUDword JVSVGA_GetMemory(void);
JVFlag JVSVGA_SetMode(JVUWord mode);
void JVSVGA_WaitForVRetrace(void);
void JVScreen_SetActive(JVUDword offset);
JVFlag JVScreen_SetVisual(JVUWord pixel, JVUWord line);
JVUWord JVScreen_SetLogicalWidth(JVUWord lwidth);
void JVScreen_ClearAll(JVUByte color);
void JVPixel_Draw(JVSWord x, JVSWord y, JVUByte color);
JVUByte JVPixel_Read(JVSWord x, JVSWord y);
void JVRectangle_Draw(JVSWord x, JVSWord y, JVUWord width, JVUWord height,
JVUByte color);
void JVLine_Draw(JVSWord x1, JVSWord y1, JVSWord x2, JVSWord y2,
JVUByte color);
void JVImage_Draw(JVSWord x, JVSWord y, JVUWord width, JVUWord height,
void *image);
void JVImage_DrawOn(JVSWord x, JVSWord y, JVUWord width,
JVUWord height, void *image);
void JVImage_DrawLimited(JVSWord x, JVSWord y, JVUWord width,
JVUWord height, void *image, JVSWord lx,
JVSWord ly, JVUWord lwidth, JVUWord lheight);
void JVImage_DrawOnLimited(JVSWord x, JVSWord y, JVUWord width,
JVUWord height, void *image, JVSWord lx,
JVSWord ly, JVUWord lwidth, JVUWord lheight);
void JVImage_Read(JVSWord x, JVSWord y, JVUWord width, JVUWord height,
void *image);
void JVPalette_Set(JVPalette palette);
void JVColor_Set(JVUByte color, JVUByte red, JVUByte green, JVUByte blue);
JVUByte JVColor_Find(JVPalette palette, JVUByte red, JVUByte green,
JVUByte blue);
void JVBIOS_SetMode(JVUByte mode);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
void JVFont_Select(JVFont *font);
void JVText_Draw(int x, int y, char *string);
void JVFont_Colorize(JVUByte color);
int JVText_GetLength(char *string);
void JVText_Input(int x, int y, char *string, int maxlength,
JVUByte fgcolor, JVUByte bgcolor);
void JVLine_DrawLimited(int x1, int y1, int x2, int y2, JVUByte color,
int xl, int yl, int width, int height);
#endif
#endif